<?php

namespace Api\Member\AuthManager\Self;

use JWTAuth;
use Api\RouteRegistrar;
use Rap2hpoutre\LaravelLogViewer\LogViewerController as BaseController;

/**
 * 私有权限控制器
 */
class LogViewerController extends BaseController
{
    /**
     * 构造方法
     */
    public function __construct ()
    {
        try {
            $this->request   = app('request');
            $token           = $this->request->cookie('token');
            $authProviderKey = app(RouteRegistrar::class)->getAuthProvidersKeyByGroup('memberManager');
            $payload         = JWTAuth::setToken($token)->payload();

            if ($payload->get('type') !== $authProviderKey) {
                error('not_found');
            }
        } catch (\Tymon\JWTAuth\Exceptions\JWTException $e) {
            die($e->getMessage());
        }
    }


}
